<include file="Public/header" /> 

<!--主窗体-->
<div class="container app">
	<!--左侧菜单-->
	<include file="Public/sidebar" /> 
	<!--左侧菜单//-->
	
	<!-- mainCon -->
	<div id="mainCon" class="mainCon">
		<h4>导航列表</h4>
		<div class="bs-example-bg-classes">
			<p class="bg-warning">
			说明：手机端底部导航，可自由灵活设置摆放位置
			</p>
		</div>
		<!--
		<div>
			<a href="<{:U('Admin/Navi/naviAdd',array('id'=>$vo['id'],'k'=>6,'sk'=>11))}>" class="btn btn-default">添加导航</a>
		</div>
		-->
		<table class="table table-bordered table-hover">
			<tr>
				<th></th>
				<th>编号</th>
				<th>标题</th>
				<th style="width:220px;">链接地址</th>
				<th>创建时间</th>
				<th>类型</th>
				<th>状态</th>
				<th>排序</th>
				<th>操作</th>
			</tr>

			<empty name="list">
				<tr><td colspan="9" style="text-align:center;color:#999">～暂无数据～</td></tr>
			<else /> 

				<foreach name="list" item="vo">
					<tr class="row-<{$vo['id']}>">
						<td>
							<a href="javascript:void(0)" title="展开" class="trigger" data-flag="r" data-id="<{$vo['id']}>">
								<i class="glyphicon glyphicon-chevron-right"></i>
							</a>
						</td>
						<td><{$vo['id']}></td>
						<td><{$vo['title']}></td>
						<td style="word-break:break-all;">
							<a href="<{$vo['url']}>" target="_blank" title="点击预览"><{$vo['url']}></a>
						</td>
						<td><{$vo['createtime']|date="Y-m-d H:i",###}></td>
						<td>
							<if condition="$vo['type'] eq 1">
								顶部导航
							<else />
								底部导航
							</if>
						</td>
						<td>
							<if condition="$vo['status'] eq 1">
								显示
							<else />
								隐藏
							</if>
						</td>
						<td><{$vo['taxis']}></td>
						<td>
							<a href="<{:U('Admin/Navi/naviAdd',array('id'=>$vo['id'],'pid'=>$vo['id'],'k'=>6,'sk'=>11))}>">添加下级导航</a>
							<a href="<{:U('Admin/Navi/naviEdit',array('id'=>$vo['id'],'k'=>6,'sk'=>11))}>">编辑</a>
							<a href="javascript:void(0)" class="delAct" data-id="<{$vo['id']}>">删除</a>
						</td>
					</tr>
					<if condition="!empty($vo['sub'])">
						<foreach name="vo['sub']" item="svo">
							<tr class="pid-<{$vo['id']}> row-<{$svo['id']}> hide">
								<td></td>
								<td><{$svo['id']}></td>
								<td><{$svo['title']}></td>
								<td style="word-break:break-all;">
									<a href="<{$svo['url']}>" target="_blank" title="点击预览"><{$svo['url']}></a>
								</td>
								<td><{$svo['createtime']|date="Y-m-d H:i",###}></td>
								<td>
									<if condition="$svo['type'] eq 1">
										顶部导航
									<else />
										底部导航
									</if>
								</td>
								<td>
									<if condition="$svo['status'] eq 1">
										显示
									<else />
										隐藏
									</if>
								</td>
								<td><{$svo['taxis']}></td>
								<td>
									<a href="<{:U('Admin/Navi/naviEdit',array('id'=>$svo['id'],'k'=>6,'sk'=>11))}>">编辑</a>
									<a href="javascript:void(0)" class="delAct" data-id="<{$svo['id']}>">删除</a>
								</td>
							</tr>
						</foreach>
					</if>
				</foreach>
			
			</empty>
			
		</table>
		
		<div class="pagebar">
			<{$pager}>
		</div>
		
	</div>
	<!-- mainCon// -->
	
</div>
<!--主窗体//-->

<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
$(function(){

	$(".trigger").click(function(){
		var flag = $(this).attr("data-flag");
		var id = $(this).attr("data-id");
		if(flag == 'r'){
			$(this).attr("data-flag","d");
			$(this).attr("title","收起");
			$(this).html('<i class="glyphicon glyphicon-chevron-down"></i>');
			$(".pid-"+id).removeClass("hide");
		}else if(flag == 'd'){
			$(this).attr("data-flag","r");
			$(this).attr("title","展开");
			$(".pid-"+id).addClass("hide");
			$(this).html('<i class="glyphicon glyphicon-chevron-right"></i>');
		}
	});
	
	$(".delAct").click(function(){
		var that = this;
		layer.confirm('您是否确认删除该记录？删除后不可恢复！', {icon: 3, title:'提示'}, function(index){
			var itemid = $(that).attr("data-id");
			$.post("<{:U('Admin/Navi/naviDel')}>",{id:itemid},function(r){
				if(r.error == 1){
					layer.close(index);
					layer.alert(r.errmsg,{icon: 2});
				}else{
					window.location.reload();
				}
			});
		});
		return false;
	});
});
</script>

<include file="Public/footer" /> 